package com.flyco.modules.stm.vo;



import com.flyco.modules.stm.enmu.SystemExceptionEnum;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;

public class ResponseInfo {

    private String code;
    private String message;
    private String requestUrl;
    private String redirectUrl = "";
    private Date timestamp = new Date();
    private Object data;

    public ResponseInfo(HttpServletRequest request, String redirectUrl, Object data) {
        this.code = SystemExceptionEnum.SUCCESSFUL.getCode();
        this.message = I18nHelper.getMessage(this.code, SystemExceptionEnum.SUCCESSFUL.getDefaultMessage());
        this.requestUrl = request.getRequestURI();
        this.redirectUrl = redirectUrl;
        this.data = data;
    }

    public ResponseInfo(String redirectUrl, Object data) {
        this.code = SystemExceptionEnum.SUCCESSFUL.getCode();
        this.message = I18nHelper.getMessage(this.code, SystemExceptionEnum.SUCCESSFUL.getDefaultMessage());
        this.redirectUrl = redirectUrl;
        this.data = data;
    }

    public ResponseInfo() {
        this.code = SystemExceptionEnum.SUCCESSFUL.getCode();
        this.message = I18nHelper.getMessage(this.code, SystemExceptionEnum.SUCCESSFUL.getDefaultMessage());
        this.data = null;
    }

    public ResponseInfo(Object data) {
        this.code = SystemExceptionEnum.SUCCESSFUL.getCode();
        this.message = I18nHelper.getMessage(this.code, SystemExceptionEnum.SUCCESSFUL.getDefaultMessage());
        this.data = data;
    }

    public ResponseInfo(String code, String message, HttpServletRequest request, String redirectUrl, Object data) {
        this.code = code;
        this.message = message;
        this.requestUrl = request.getRequestURI();
        this.redirectUrl = redirectUrl;
        this.data = data;
    }

    public ResponseInfo(String code, String message, String redirectUrl, Object data) {
        this.code = code;
        this.message = message;
        this.redirectUrl = redirectUrl;
        this.data = data;
    }

    public ResponseInfo(String code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public ResponseInfo(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public String getCode() {
        return this.code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return this.message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getRequestUrl() {
        return this.requestUrl;
    }

    public void setRequestUrl(String requestUrl) {
        this.requestUrl = requestUrl;
    }

    public String getRedirectUrl() {
        return this.redirectUrl;
    }

    public void setRedirectUrl(String redirectUrl) {
        this.redirectUrl = redirectUrl;
    }

    public Date getTimestamp() {
        return this.timestamp;
    }

    public Object getData() {
        return this.data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
